package com.yanq.liancar.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.BShopGoodsListBean;
import com.yanq.liancar.bean.SmallBGoodsListBean;

import java.util.List;

public class SmallBGoodsListAdapter extends BaseQuickAdapter<BShopGoodsListBean.DataBean.ListBean,BaseViewHolder> {
    public SmallBGoodsListAdapter(int layoutResId, @Nullable List<BShopGoodsListBean.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BShopGoodsListBean.DataBean.ListBean item) {
        helper.setText(R.id.tv_title,item.getGoods_name())
                .setText(R.id.tv_content,item.getGoods_introduction())
                .setText(R.id.tv_price,"¥"+item.getSale_price())
                .setText(R.id.tv_num,"已售"+item.getSale_num()+"件");

        RequestOptions options=new RequestOptions();
        options.error(R.mipmap.item_img);
        Glide.with(mContext).load(item.getGoods_photo()).apply(options).into((ImageView) helper.getView(R.id.item_img));
    }
}
